using Microsoft.EntityFrameworkCore;

namespace Services.Initial.Extensions;
public static class DbContextOptionsBuilderFactory
{
    /// <summary>
    /// 帮助快速构造dbContext的设计时服务
    /// </summary>
    /// <typeparam name="TDbContext">指定的DbContext类型</typeparam>
    /// <returns></returns>
    public static DbContextOptionsBuilder<TDbContext> Create<TDbContext>() where TDbContext : DbContext
    {
        var optionsBuilder = new DbContextOptionsBuilder<TDbContext>();
        optionsBuilder.UseSqlServer(WebApplicationBuilderExtensions.ConnectionString);
        return optionsBuilder;
    }
}